package cn.itrip.order.service;

import cn.itrip.dao.ItripLabelDicMapper;
import cn.itrip.pojo.ItripLabelDic;
import cn.itrip.vo.ItripLabelDicVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@Service
public class LabelDicServiceImpl implements LabelDicService{

    @Resource
    private ItripLabelDicMapper itripLabelDicMapper;

    @Override
    public List<ItripLabelDicVO> selectByVOList(Long parentId) {

        List<ItripLabelDic> labelDics = itripLabelDicMapper.getHotelRoomBedByParentId(parentId);

        List<ItripLabelDicVO> labelDicVOS = new ArrayList<>();
        ItripLabelDicVO itripLabelDicVO = null;

        for(ItripLabelDic itripLabelDic:labelDics){
            itripLabelDicVO = new ItripLabelDicVO();
            itripLabelDicVO.setName(itripLabelDic.getName());
            itripLabelDicVO.setId(itripLabelDic.getId());
            if(itripLabelDic.getDescription()!=null)
            itripLabelDicVO.setDescription(itripLabelDic.getDescription());
            if(itripLabelDic.getPic()!=null)
            itripLabelDicVO.setPic(itripLabelDic.getPic());
            labelDicVOS.add(itripLabelDicVO);
        }


        return labelDicVOS;
    }
}
